home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / misc / emu / ST4Amiga.lha / ST / ST.s < prev    next >
Encoding:
Text File  |  1995-04-04  |  1.6 KB  |  102 lines

  1. ; © Stefan Haubenthal 1992-95
  2.     opt    o-
  3. *    include    prog:asm/include/wb.i
  4. *    incdir    prog:asm/include
  5. *    include    easystart.i
  6.  
  7. version=    "2.03"
  8. allocabs=    -$0cc
  9. freemem=    -$0d2
  10. oldopenlibrary=    -$198
  11. closelibrary=    -$19e
  12. open=        -$01e
  13. read=        -$02a
  14. copymemquick=    -$276
  15. mode_oldfile=    1005
  16.  
  17. scr=        $30000
  18. rom=        $40000
  19. romsize=    $30000
  20. emu=        $70000
  21.  
  22.     move.l    4.w,a6
  23.     move.l    #romsize,d0
  24.     lea    rom,a1
  25.     jsr    allocabs(a6)
  26.     tst.l    d0
  27.     beq    exit
  28.     move.l    #emusize,d0
  29.     lea    emu,a1
  30.     jsr    allocabs(a6)
  31.     tst.l    d0
  32.     beq    exit
  33.     lea    dosname(pc),a1
  34.     jsr    oldopenlibrary(a6)
  35.     move.l    d0,a6
  36.     move.l    #romname,d1
  37.     move.l    #mode_oldfile,d2
  38.     jsr    open(a6)
  39.     beq.s    exit2
  40.     move.l    d0,d1
  41.     move.l    #rom,d2
  42.     move.l    #romsize,d3
  43.     jsr    read(a6)
  44.     bsr.s    patch
  45.     move.l    4.w,a6
  46.     lea    start_emu,a0
  47.     lea    emu,a1
  48.     move.l    #emusize,d0
  49.     jsr    copymemquick(a6)
  50.     lea    emu,a0
  51.     move.l    #$4e714e71,$a0(a0)
  52.     move.l    #$4e714e71,$b2(a0)
  53.     move.l    #$4e714e71,$b6(a0)
  54.     jmp    emu+4
  55. ; goodbye AmigaDOS!
  56. exit2    move.l    a6,a1
  57.     move.l    4.w,a6
  58.     jsr    closelibrary(a6)
  59.     move.l    #emusize,d0
  60.     lea    emu,a1
  61.     jsr    freemem(a6)
  62. exit    moveq    #20,d0
  63.     rts
  64.  
  65. patch    lea    reloc,a0
  66.     sub.l    a1,a1
  67. next_reloc    moveq    #0,d0
  68.     cmp    #0,(a0)
  69.     add    (a0)+,a1
  70.     bne.s    not_packed
  71.     move.b    (a0)+,d0
  72.     move.b    (a0)+,d1
  73. next_packed    add    d1,a1
  74. not_packed    sub.b    #($fc0000-rom)>>16,(a1,d2.l)
  75.     dbra    d0,next_packed
  76.     cmp.l    #diff,a0
  77.     blo.s    next_reloc
  78. next_diff    move.l    (a0)+,a1
  79.     move    (a0)+,d0
  80.     move.b    d0,(a1,d2.l)
  81.     cmp.l    #end_diff,a0
  82.     blo.s    next_diff
  83.     rts
  84.  
  85.     dc.b    "$VER: ST4Amiga V"
  86.     dc.l    version
  87.     dc.b    0
  88. dosname    dc.b    "dos.library",0
  89. romname    dc.b    "TOS.IMG",0
  90.  
  91.     data
  92. ; { delta_offset.w
  93. ; | 0.w number-1.b delta_offset.b }
  94. reloc    include    reloc.asm
  95. ; { offset.l data.w }
  96. diff    include    diff.asm
  97. end_diff
  98.  
  99.     code
  100. start_emu    include    emu.asm
  101. emusize=    *-emu
  102.